package com.sws.orderMS.pojo;

import java.util.Date;
import java.util.List;

public class Order {

	private long id;
	private List<OrderItem> orderList;
	private Date date;
	private String memo;
	
	public Order() {
	}
	
	public Order(long id, List<OrderItem> orderList, Date date, String memo) {
		this.id = id;
		this.orderList = orderList;
		this.date = date;
		this.memo = memo;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public List<OrderItem> getOrderList() {
		return orderList;
	}
	
	public void setOrderList(List<OrderItem> orderList) {
		this.orderList = orderList;
	}
	
	public void addItem(OrderItem item) {
		orderList.add(item);
	}
	
	public boolean removeItem(OrderItem item) {
		return orderList.remove(item);
	}
	
	public void removeAll(List<OrderItem> removeList) {
		orderList.removeAll(removeList);
	}
	
	public double getTotal() {
		double total = 0;
		for (OrderItem item: orderList) {
			total = total + item.getMoney();
		}
		return total;
	}
}
